package cz.muni.fi.pb138.gscholarinfo.classes;

import java.util.Collections;
import java.util.List;
import java.util.LinkedList;

public class PublicationCitations {
    private Publication publication;
    private List<Publication> citedIn;
        
    public PublicationCitations() {
        this.citedIn = new LinkedList<Publication>();
    }
    
    public PublicationCitations(Publication publication) {
        this.publication = publication;
        this.citedIn = new LinkedList<Publication>();
    }

    public List<Publication> getCitedIn() {
        return Collections.unmodifiableList(this.citedIn);
    }

    public void addCitedIn(Publication citedIn) {
        this.citedIn.add(citedIn);
    }

    public Publication getPublication() {
        return this.publication;
    }

    public void setPublication(Publication publication) {
        this.publication = publication;
    }
    
    @Override
    public String toString() {
        String ret = publication.toString() + ";- cited in : {" + System.getProperty("line.separator");
        for (Publication item : this.citedIn)
            ret += item.toString() + System.getProperty("line.separator");
        
        ret += "}" + System.getProperty("line.separator");
        
        return ret;
    }
}
